from rest_framework import serializers
from .models import McManage, McGender, McRole
from app.gender.serializers import McGenderSerializer
from app.role.serializers import McForeignRoleSerializer

class McManageSerializer(serializers.ModelSerializer):
    gender = McGenderSerializer(read_only=True)
    role = McForeignRoleSerializer(read_only=True)

    gender_id = serializers.PrimaryKeyRelatedField(
        queryset=McGender.objects.all(), source="gender", write_only=True
    )
    role_id = serializers.PrimaryKeyRelatedField(
        queryset=McRole.objects.all(), source="role", write_only=True
    )
    class Meta:
        model = McManage
        fields = '__all__'



